/*
** Copyright (C) 2010 Calin Radoni
**
** This file is part of CHScanner.
**
** CHScanner is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** CHScanner is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with CHScanner. If not, see <http://www.gnu.org/licenses/>.
*/

#include "StdAfx.h"
#include "MWmiData.h"

//---------------------------------------------------------------------------

MWmiData::MWmiData(void)
{
	Initialize();
}

MWmiData::~MWmiData(void)
{
}

//---------------------------------------------------------------------------

void MWmiData::Initialize(void)
{
	xType = __wmitW32Empty;
	xStatus = __wmisUnknown;

	wmiCDROMDrive.Initialize();
	wmiDesktopMonitor.Initialize();
	wmiDiskDrive.Initialize();
	wmiDiskPartition.Initialize();
	wmiGroup.Initialize();
	wmiOperatingSystem.Initialize();
	wmiPhysicalMemory.Initialize();
	wmiProcessor.Initialize();
	wmiQuickFixEngineering.Initialize();
	wmiShare.Initialize();
	wmiUserAccount.Initialize();
	wmiVideoController.Initialize();
	wmiLoggedUser.Initialize();
}

void MWmiData::LoadFromPointer(MWmiData* dataIn)
{
	bool res;

	Initialize();
	if(dataIn==NULL) return;

	xType = dataIn->xType;
	xStatus = dataIn->xStatus;

	res = true;
	res &= wmiCDROMDrive.SetFromPointer(         (MWmiInfo*)&dataIn->wmiCDROMDrive);
	res &= wmiDesktopMonitor.SetFromPointer(     (MWmiInfo*)&dataIn->wmiDesktopMonitor);
	res &= wmiDiskDrive.SetFromPointer(          (MWmiInfo*)&dataIn->wmiDiskDrive);
	res &= wmiDiskPartition.SetFromPointer(      (MWmiInfo*)&dataIn->wmiDiskPartition);
	res &= wmiGroup.SetFromPointer(              (MWmiInfo*)&dataIn->wmiGroup);
	res &= wmiOperatingSystem.SetFromPointer(    (MWmiInfo*)&dataIn->wmiOperatingSystem);
	res &= wmiPhysicalMemory.SetFromPointer(     (MWmiInfo*)&dataIn->wmiPhysicalMemory);
	res &= wmiProcessor.SetFromPointer(          (MWmiInfo*)&dataIn->wmiProcessor);
	res &= wmiQuickFixEngineering.SetFromPointer((MWmiInfo*)&dataIn->wmiQuickFixEngineering);
	res &= wmiShare.SetFromPointer(              (MWmiInfo*)&dataIn->wmiShare);
	res &= wmiUserAccount.SetFromPointer(        (MWmiInfo*)&dataIn->wmiUserAccount);
	res &= wmiVideoController.SetFromPointer(    (MWmiInfo*)&dataIn->wmiVideoController);
	res &= wmiLoggedUser.SetFromPointer(         (MWmiInfo*)&dataIn->wmiLoggedUser);

	if(!res)
		Initialize();
}

//---------------------------------------------------------------------------
